<!--
 * @Author: 李九阳
 * @Date: 2021-12-13 08:37:10
 * @LastEditors: 九阳
 * @LastEditTime: 2022-10-24 11:25:05
-->
<template>
  <div class="amap" ref="map-container"></div>
</template>
<script lang="ts">
declare var AMap: {
  Map: new (arg0: string, arg1: { zoom: number; resizeEnable: boolean }) => any;
  plugin: (arg0: string | string[], arg1: { (): void; (): void }) => void;
  ToolBar: new () => any;
  Driving: new () => any;
};
import { defineComponent, onMounted, ref, nextTick } from "vue";

export default defineComponent({
  name: "gaudMap",
  setup() {
    return {};
    onMounted(() => {
      const map = new AMap.Map("container", {
        zoom: 13, // 缩放等级
        resizeEnable: true, // 可否改变大小
      });

      // 单个插件
      AMap.plugin("AMap.ToolBar", function () {
        //异步加载插件
        var toolbar = new AMap.ToolBar();
        map.addControl(toolbar);
      });

      // 多个插件
      AMap.plugin(["AMap.ToolBar", "AMap.Driving"], function () {
        //异步同时加载多个插件
        var toolbar = new AMap.ToolBar();
        map.addControl(toolbar);
        var driving = new AMap.Driving(); //驾车路线规划
        driving.search(/*参数*/);
      });
    });
  },
});
</script>
<style lang="scss" scoped></style>
